import request from '@/utils/request.js'

/**
 * 分页查询题目
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const pageQueryQuestion = (data) => {
  return request.post('/question/page', data)
}

/**
 * 根据id查询题目
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getQuestionInfoById = (data) => {
  return request.get('/question/' + data)
}

/**
 * 根据id查询题目和创建用户详情
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getQuestionUserInfoById = (data) => {
  return request.get('/question/user/' + data)
}

/**
 * 保存题目
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const saveQuestion = (data) => {
  return request.post('/question', data)
}

/**
 * 修改题目
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const updateQuestion = (data) => {
  return request.put('/question', data)
}

/**
 * 删除题目
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const deleteQuestion = (data) => {
  return request.delete('/question', {data})
}

/**
 * 根据id查询做题页面题目详情
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getQuestionDetailById = (data) => {
  return request.get('/question/detail/' + data)
}

/**
 * 分页查询题目列表
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const pageQueryQuestionTable = (data) => {
  return request.post('/question/page_table', data)
}

/**
 * 提交题目
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const submitQuestion = (data) => {
  return request.post('/question/submit', data)
}

/**
 * 分页查询题目提交记录
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const pageQueryQuestionSubmit = (data) => {
  return request.post('/question/submit/page', data)
}

/**
 * 根据id查询题目提交记录详情
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getQuestionSubmitDetail = (data) => {
  return request.get('/question/submit/' + data)
}

/**
 * 删除题目提交记录
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const deleteQuestionSubmit = (data) => {
  return request.delete('/question/submit', {data})
}
